package com.jvyou.framework.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jvyou.framework.domain.entity.Role;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 角色信息表(Role)表数据库访问层
 *
 * @author 橘柚
 * @since 2025-05-29 17:25:35
 */
public interface RoleMapper extends BaseMapper<Role> {


    @Select("SELECT DISTINCT r.role_key FROM sys_role r LEFT JOIN sys_user_role ur ON r.id = ur.role_id WHERE ur.user_id = #{userId} AND r.status = '0'")
    List<String> getRoleByUserId(@Param("userId") Long userId);
}
